#include "../sqlite3/sqlite3.h"

class MzSQL{
public:
	MzSQL(char* dbpath);
	virtual ~MzSQL();
	
	void getLastError();       // print the error
	
	bool execSql(char* sql);          // directly execute sql
	bool prepareSql(char* sql);         // prepare sql statement / use '@xxx'
	
	void bindInt(char* name, int n);      // bind int param
	void bindText(char* name, char* text);       // bind text
	
	int step();             // execute pStmt return err code like SQLITE_ROW SQLITE_DONE
	const unsigned char* columnText(int iCol);      // fetch data
	int columnInt(int iCol);
	
	
private:
	sqlite3 *db;            // db handle
	sqlite3_stmt *pStmt;     // handle to statement
	
	char **result, *errmsg;            // need to free


};
